home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / misc / emu / ATUtilities.lha / ATUtilities / play.c < prev    next >
C/C++ Source or Header  |  2000-09-26  |  3KB  |  116 lines

  1. #include <exec/types.h>
  2.  
  3. VOID Auswahl();
  4.  
  5. struct GfxBase *GfxBase;
  6. struct IntuitionBase *IntuitionBase;
  7. struct ATUtilitiesBase *ATUtilitiesBase;
  8. struct DiskfontBase *DiskfontBase;
  9.  
  10. VOID main(argc,argv)
  11.  LONG   argc;
  12.  UBYTE *argv[];
  13. {
  14.  GfxBase=OpenLibrary("graphics.library",0L);
  15.  IntuitionBase=OpenLibrary("intuition.library",0L);
  16.  DiskfontBase=OpenLibrary("diskfont.library",0L);
  17.  ATUtilitiesBase=OpenLibrary("at-utilities.library",0L);
  18.  if((DiskfontBase!=NULL)&&(ATUtilitiesBase!=NULL))
  19.   {
  20.    Auswahl();
  21.    Auswahl();
  22.   }
  23.  if(ATUtilitiesBase) CloseLibrary(ATUtilitiesBase);
  24.  if(DiskfontBase) CloseLibrary(DiskfontBase);
  25.  exit(0);
  26. }
  27.  
  28. struct E
  29. {
  30.  UWORD HiFiPlayerWait;
  31.  UBYTE HiFiPlayerNum;
  32.  UBYTE HiFiPlayerAutoStart;
  33.  UBYTE HiFiPlayerWaitActive;
  34. };
  35.  
  36. #define YES 1
  37. struct E Einstellungen=
  38. {
  39.  60,
  40.  0,
  41.  YES,
  42.  YES,
  43. };
  44.  
  45. /* HiFi-Player Auswahl */
  46. UBYTE *PlayerNames[]={"ATUtilities HiFi-Player",
  47.                       "Externer Player 1",
  48.                       "Externer Player 2",
  49.                       "Externer Player 3"};
  50.  
  51. VOID Auswahl()
  52. {
  53.  UBYTE                        *vz;
  54.  UBYTE                         str[8];
  55.  REGISTER BOOL                 ende;
  56.  REGISTER ULONG                Class;
  57.  register struct Gadget       *gad,*autos,*verz;
  58.  register struct Window       *win;
  59.  register struct RastPort     *rp;
  60.  register struct IntuiMessage *msg;
  61.  
  62.  win=CreateStdWindow("HiFi-Play - Auswahl",75,75,450,90,
  63.                      CLOSEWINDOW|GADGETUP,
  64.                      ACTIVATE|WINDOWDEPTH|WINDOWDRAG|WINDOWCLOSE);
  65.  if(win!=NULL)
  66.   {
  67.    rp=win->RPort;
  68.    SetFont(rp,GetOpalFont());
  69.    CreateBoolGadget(win,15,15,25,12,"»",1);
  70.    DrawNTextBorder(win,45,15,390,12,PlayerNames[Einstellungen.HiFiPlayerNum]);
  71.    if(Einstellungen.HiFiPlayerAutoStart!=0)
  72.      autos=CreateSToggleGadget(win,15,40,420,12,"Auto-Start durch ATKeyboard",20);
  73.    else
  74.      autos=CreateNToggleGadget(win,15,40,420,12,"Auto-Start durch ATKeyboard",20);
  75.    if(Einstellungen.HiFiPlayerWaitActive!=0)
  76.      verz=CreateSToggleGadget(win,15,55,420,12,"Verzögerung des Auto-Starts",30);
  77.    else
  78.      verz=CreateNToggleGadget(win,15,55,420,12,"Verzögerung des Auto-Starts",30);
  79.    sprintf(&str,"%ld",Einstellungen.HiFiPlayerWait);
  80.    vz=CreateIntegerGadget(win,385,70,50,12,&str,5,10);
  81.    SelectStdFPen(rp);
  82.    WriteText(rp,25,78,"Verzögerung in Sekunden:");
  83.  
  84.    ende=FALSE;
  85.    while(ende==FALSE)
  86.     {
  87.      WaitPort(win->UserPort);
  88.      msg=GetMsg(win->UserPort);
  89.      Class=msg->Class;
  90.      gad=msg->IAddress;
  91.      ReplyMsg(msg);
  92.      switch(Class)
  93.       {
  94.        case CLOSEWINDOW:
  95.          ende=TRUE;
  96.         break;
  97.        case GADGETUP:
  98.          switch(gad->GadgetID)
  99.           {
  100.            case 1:
  101.              Einstellungen.HiFiPlayerNum+=1;
  102.              if(Einstellungen.HiFiPlayerNum>3) Einstellungen.HiFiPlayerNum=0;
  103.              DrawCNTextBorder(win,45,15,390,12,PlayerNames[Einstellungen.HiFiPlayerNum]);
  104.             break;
  105.           }
  106.         break;
  107.       }
  108.     }
  109.    if(autos->Flags & SELECTED) Einstellungen.HiFiPlayerAutoStart=1; else Einstellungen.HiFiPlayerAutoStart=0;
  110.    if(verz->Flags & SELECTED) Einstellungen.HiFiPlayerWaitActive=1; else Einstellungen.HiFiPlayerWaitActive=0;
  111.    Einstellungen.HiFiPlayerWait=atol(vz);
  112.    DeleteStdWindow(win);
  113.   }
  114. }
  115.  
  116.